package com.zeng;

public class YearMonth {
    private final int year;
    private final int month;

    public YearMonth(int year, int month) {
        if (year < 1) {
            throw new IllegalArgumentException("无效的年份：年份必须大于等于 1，当前输入年份为 " + year);
        }
        if (month < 1 || month > 12) {
            throw new IllegalArgumentException("无效的月份：月份必须在 1 到 12 之间，当前输入月份为 " + month);
        }
        this.year = year;
        this.month = month;
    }

    public int getYear() {
        return year;
    }

    public int getMonth() {
        return month;
    }

    public boolean isLeapYear() {
        return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
    }
}